import { transMultiAuthRoutesToVueRoute } from "@/utils/router/menu";
import { App } from "vue";
import {
  createRouter, createWebHashHistory, createWebHistory,
} from "vue-router";
import { createRouteGuard } from "./guard";
// import studentRoutes from "./student/route";
// import teacherRoute from "./teacher/route";
import { constantRoutes } from "./public/constRoutes";

// const routes: Array<RouteRecordRaw> = transMultiAuthRoutesToVueRoute(teacherRoute);

const history = process.env.VUE_APP_HASH_ROUTE === 'true' ? createWebHashHistory() : createWebHistory();

export const router = createRouter({
  history,
  routes: transMultiAuthRoutesToVueRoute(constantRoutes),
});

export async function setupRouter(app: App) {
  app.use(router)
  createRouteGuard(router)
  await router.isReady()
}

export default router;
